<template>
  <div class="modify-dialog">
    <slot> </slot>
    <el-dialog v-bind="dialogOpts" :visible.sync="dialogVisible">
      <Form v-bind="formOpts" v-on="formEvent">
        <template #formBtn>
          <div class="dialog-footer">
            <el-button @click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="onConfirm"> 确 定 </el-button>
          </div>
        </template>
      </Form>
    </el-dialog>
  </div>
</template>

<script>
import modifyMixins from "@/mixins/modifyMixins.vue";

export default {
  mixins: [modifyMixins],
  components: {},
  data() {
    return {
      dialogTitle: "采购单付款",
      labelPosition: "left",
      form: {
        paymentAmount: {
          tag: "el-input",
          label: "付款金额",
          value: "",
          props: {
            type: "number",
            min: 0,
            placeholder: "请输入付款金额",
          },
        },
        paymentVouchers: {
          tag: "Uploader",
          label: "付款金额截图",
          value: [],
          props: {},
        },
      },
    };
  },
  computed: {},
  methods: {
    onSubmit(form) {
      const { modify, row, fileList } = this;
      if (!form.paymentAmount) return this.$message.error("请输入金额");
      if (!form.paymentVouchers.length)
        return this.$message.error("请上传图片");
      form.paymentVouchers = form.paymentVouchers.join(",");
      form.procureId = row.procureId;
      this.$api["procureProcurePaymentAdd"](form).then(this.submitDoneMsg);
    },
  },
};
</script>

<style lang="less" scoped></style>
